Skip to content

feat: support custom BuildKit frontends - #83

Open
zachspar wants to merge 3 commits into
apple:mainfrom
zachspar:spar/arbitrary-build-frontend-support
Open

feat: support custom BuildKit frontends#83
zachspar wants to merge 3 commits into
apple:mainfrom
zachspar:spar/arbitrary-build-frontend-support

Conversation

@zachspar

@zachspar zachspar commented Jun 13, 2026

Copy link
Copy Markdown

Background

This PR implements my feature request in #82 to enable building images using custom BuildKit frontends (ie. # syntax=ghcr.io/builderhub/yamlfile:latest, BUILDKIT_SYNTAX, and explicit gateway.v0 metadata), while keeping the existing native dockerfile.v1 path for plain Dockerfiles.

Previously the shim always parsed the build file as a Dockerfile before the build started and always ran a hard-coded dockerfile.v1 frontend. That broke external frontends like Yamlfile with errors such as unknown instruction: apiVersion:.

New Approach

Native Dockerfiles keep existing shim-specific behavior. External frontends delegate to the declared frontend image via BuildKit’s gateway mechanism.

Eventually it would be nice if we wire frontend / frontend-opt metadata from container, but that is not a requirement to achieve the desired behavior.

flowchart TD
    Input[Build file bytes] --> Resolve[resolveFrontend]
    Resolve -->|native| Native[Skip external path]
    Native --> Parse[parseDockerfileMetadata + dockerfile.v1]
    Resolve -->|external| Skip[Skip Dockerfile parse]
    Skip --> Stage[stageBuildDefinition + fssync staging]
    Stage --> Gateway[forwardGateway to gateway.v0]
Loading

@zachspar
zachspar force-pushed the spar/arbitrary-build-frontend-support branch 6 times, most recently from 11af09f to 47e9fe5 Compare June 16, 2026 20:38
Signed-off-by: Zachary Spar <zachspar@gmail.com>
@zachspar
zachspar force-pushed the spar/arbitrary-build-frontend-support branch 3 times, most recently from 804bfd5 to bfcda1e Compare June 16, 2026 20:45
Signed-off-by: Zachary Spar <zachspar@gmail.com>
@zachspar
zachspar force-pushed the spar/arbitrary-build-frontend-support branch from bfcda1e to 20c98aa Compare June 16, 2026 20:45
Signed-off-by: Zachary Spar <zachspar@gmail.com>
@zachspar

Copy link
Copy Markdown
Author

cc @katiewasnothere -- apologies for the ping, but I'd greatly appreciate some eyes on this. I'm trying to consolidate my tooling, and blocked on being able to build my images with Apple container until container build supports custom buildkit frontends :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants